package com.cq.hd.system.controller;

import com.cq.hd.common.response.Result;
import com.cq.hd.common.response.ResultGenerator;
import com.cq.hd.system.service.TbWithdrawalConfigService;
import com.cq.hd.system.api.TbWithdrawalConfigApi;
import com.cq.hd.system.api.dto.WithdrawalConfigSaveDto;
import com.cq.hd.system.api.vo.WithdrawalConfigVo;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 提现配置表 前端控制器
 * </p>
 *
 * @author mYunYu
 * @since 2023-11-19
 */
@RestController
public class TbWithdrawalConfigController implements TbWithdrawalConfigApi {

    @Autowired
    private TbWithdrawalConfigService withdrawalConfigService;

    @ApiOperation(value = "提现配置详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "withdrawalUserType", value = "提现用户类型(1-商户本金，2-经纪人，3-商户补贴)", required = true, paramType = "query", dataType = "Long"),
            @ApiImplicitParam(name = "financialAccountType", value = "资金账户类型，1-自建资金账户 2-平台资金账户", required = true, paramType = "query", dataType = "Long")
    })
    @ApiResponse(response = WithdrawalConfigVo.class, code = 200, message = "接口返回对象参数")
    @Override
    public Result<WithdrawalConfigVo> details(Integer withdrawalUserType, Integer financialAccountType) {
        return ResultGenerator.success(withdrawalConfigService.details(withdrawalUserType, financialAccountType));
    }

    @ApiOperation(value = "保存提现配置")
    @Override
    public Result<Object> saveWithdrawalConfig(@RequestBody WithdrawalConfigSaveDto withdrawalConfigSaveDto) {
        return ResultGenerator.success(withdrawalConfigService.saveWithdrawalConfig(withdrawalConfigSaveDto));
    }

}
